package com.example.demo.entity.pojo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.example.demo.Enums.SexEnum;
import com.example.demo.annotation.Check;
import com.example.demo.annotation.CheckField;
import com.example.demo.entity.base.BaseEntity;
import com.example.demo.unique.annotation.UniqueFiled;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @version 1.0
 * @Author: LJP
 * @Description: 用户表 (user)
 * @Date: Created in 11:48 2021/11/26
 */
@Data
@Check
@TableName(value = "user")
public class User extends BaseEntity {

    /**
     * 姓名
     */
    @CheckField(msg = "真实姓名不能为空")
    private String name;

    /**
     * 账户名
     */
    @CheckField(msg = "账户名不能为空")
    @UniqueFiled(filed = "account_name", info = "账户名")
    private String accountName;

    /**
     * 密码
     */
    @CheckField(msg = "密码不能为空")
    private String password;

    /**
     * 年龄
     */
    private Integer age;

    /**
     * 性别
     */
    private SexEnum sex;

    /**
     * 生日
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime birthday;

}
